const express = require('express');
      router = express.Router();

//个人信息页面渲染
router.get('/user',(req,res) => {
  res.render('user/photo',{
    title:'个人信息'
  })
})

//头像上传
router.post('/header',uploads.single('header'),signIn,(req,res) => {
      var name = req.cookies.username
      var header = req.file.filename
      header = 'uploads/' + header 
      res.cookie('img',header)
      var userId = req.cookies.userId
      // console.log(userId)
      User.update({_id:userId},{image:header}).exec(function(err,data){
        console.log(data)
      })
      send(res,'success','头像上传成功..')
})


module.exports = router